<?php
	$daction = $_SESSION['action'];
	if(isset($_REQUEST['action'])){
		$daction = $_REQUEST['action'];
	}
	
		if($daction=="re_meeting_pending" ){
			mysql_query("UPDATE listapprove SET isView='1' WHERE (IDGroupApprove=(SELECT a.IDGroupApprove FROM approvedoc a WHERE a.IDApproveDoc='$id'));");
		}
		if($daction=="my_meeting_sending" ){
			mysql_query("UPDATE approvedoc SET isView='1' WHERE (IDApproveDoc='$id')");
		}
	$query = mysql_query("select a.Tile,a.Content,a.Timecreate,a.IDGroupApprove,a.IDEmployee from approvedoc a where a.IDApproveDoc = '$id'");
		while ($row = mysql_fetch_array($query))
		{
			$dtitle = $row[Tile];
			$dcontent = $row[Content];
			$dtime = $row[Timecreate];
			$didgroupapprover = $row[IDGroupApprove];
			
			$didemployee = $row[IDEmployee];
		}
	$queryEmployee = mysql_query("SELECT e.FullName,dl.DepartmentName,e.Position 
				FROM employee e INNER JOIN department_lang dl ON dl.IDDepartment = e.IDDepartment
				WHERE e.IDEmployee = '$didemployee' AND dl.LangID = '$lang'");
		while ($row = mysql_fetch_array($queryEmployee))
		{
			$dnameemployee = $row[FullName];
			$dnamedepartment = $row[DepartmentName];
			$dposition = $row[Position];
		}
	$queryApprove=mysql_query("SELECT e.FullName,dl.DepartmentName 
							FROM listapprove l,employee e,department_lang dl 
							WHERE l.IDEmployee=e.IDEmployee AND l.IDGroupApprove='$didgroupapprover' AND e.IDDepartment=dl.IDDepartment AND dl.LangID='$lang';");
?>

<style type="text/css">
	
	a, img {text-decoration:none; border:none}
	.btn {border-bottom: 3px solid #508E21; background:#424242}
	.btn img {opacity:.6}
	.btn a:hover img {opacity:1}
	.print_report { margin:10px auto; padding:30px}
	span#form-caption {
    display: block;
    font-weight: bold;
    margin: 0 0 30px;
    text-align: center;
    text-transform: uppercase;}
	table.padd tr th {
    background: none repeat scroll 0 0 #EEEEEE;
    border: 1px solid #424242;
    padding: 5px;
}
table.padd tr td {
    border: 1px solid #424242;
    padding: 5px;
}
.rcontent {float: right;
    height: auto;
    width: auto;}
	ul.list-approver li {
    border-style: solid;
    border-width: 1px;
    float: left;
    list-style: none outside none;
    width: 75px;
}
.approver-title {
    background: none repeat scroll 0 0 #EEEEEE;
    display: block;
    padding: 5px 0;
    text-align: center;
}
.approver-name {
    border-top: 1px solid #424242;
    display: block;
    height: 45px;
    padding: 3px 0;
    text-align: center;
    vertical-align: middle;
}
.approver-signature {
    border-top: 1px solid #424242;
    display: block;
    height: 80px;
    text-align: center;
    vertical-align: middle !important;
}
th.top {
    padding: 14px 0 !important;
}
</style>

	<div class="title"></div>
	<form action="approve-handle.php" method="post">
	<input type="hidden" name="id" value="<?=$id?>" />
	<input type="hidden" name="type" value="<?=$type?>" />
	<input type="hidden" name="action" value="<?=$daction?>" />
	<div class="btn">
    	<table cellspacing="10" style="width: 100%;">
        	<tr>
            	<td align="left" style="width:80px;text-align:center;">
                	<a href="printer/printer11.php?id=<?=$id?>&type=<?=$type?>" target="_blank"><img src="images/primante-icon.png" alt="" /></a>
                </td>
                <?php if($daction=="my_meeting_sending" ){?>
                <td style="text-align:center;width:80px">
                	<input type="submit" name="Delete" value="" style="background:url(images/trash-icon.png) no-repeat; width:48px; height:48px; border:none; top:0px; left:0px; right:0px; bottom:0px; margin:auto" />
                </td>
                <?php }?>
                <td align="right">
                	<?php if(isset($_REQUEST['page'])){?>
						<a href="<?=$_SERVER['HTTP_REFERER']?>&page=<?=$_REQUEST['page']?>"><img src="images/exit-icon.png" alt="" /></a>
					<?php }else{?>
						<a href="<?=$_SERVER['HTTP_REFERER']?>"><img src="images/exit-icon.png" alt="" /> </a>
					<?php }?>
                	
                </td>
            </tr>
            <tr>
            	<td align="left"; style="color:white; text-align:center">Print</td>
            	 <?php if($daction=="my_meeting_sending" ){
            	 		$_SESSION['idGroup']=$didgroupapprover;
						$_SESSION['id_employee']=$id_employee;
            	 	?>
                <td style="color:white; text-align:center">Delete</td>
                 <?php }?>
                <td align="right" style=" color:white; padding-right:8px; text-align: right">Exit</td>
            </tr>
        </table>
    </div>
    <div class="print_report" style="min-height: 758px;">
    	<div style="float: left; width:350px">
        	<span id="form-caption">Meeting Document </span>
            <table style="border-collapse:collapse" class="padd">
            	<tr>
                	<th align="left" width="20%" valign="top">Writer</th>
					<td align="left" width="30%" valign="top"><?=$dnameemployee?></td>
                </tr>
                <tr>
                	<th align="left" width="20%" valign="top">Department</th>
					<td align="left" width="30%" valign="top"><?=$dnamedepartment?></td>
                </tr>
                <tr>
                	<th align="left" width="20%" valign="top">Meeting date</th>
					<td align="left" width="30%" valign="top"><?=$dtime?></td>
                </tr>
            </table>
        </div>
        <div class="rcontent">
        	<table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse; float:left">
            	<tr>
                	<td width="35px" valign="middle">
                    	<img src="images/approver_en.png" alt="" />
                    </td>
                    <td>
                    	<ul class="list-approver">
                    		<?php while ($row=mysql_fetch_array($queryApprove)){?>
							<li>
                            	<span class="approver-title"><?=$row[DepartmentName]?></span>
                            	<span class="approver-name"><?=$row[FullName]?></span>
                            	<span class="approver-signature"></span>
                            </li>
                           <?php }?>
                        </ul>
                    </td>
                </tr>
            </table>
        </div>
        <br style="clear:both" />
        <br />
        <table class="padd" width="100%" cellspacing="0" cellpadding="0">
        	<tr>
            	<th class="top" colspan="2"></th>
            </tr>
            <tr>
            	<th align="left" width="15%">Title </th>
				<td width="85%"><?=$dtitle?></td>
            </tr>
        </table>   
        <table class="padd" width="100%" cellspacing="0" cellpadding="0">
        	<tr>
                <th align="left" width="15%">Content </th>
                <td width="85%" style="padding-left: 20px"><?=$dcontent?></td>
            </tr>
        </table>     
        <table width="100%" cellspacing="0" cellpadding="0" border="0">
            <tr>
            	<td align="left" width="50%">ELI_F_0740_05</td>
            	<td align="right" width="50%">ELISOFT.LD</td>
            </tr>
        </table>
    </div>
    </form>

